import pytest

from config import URL, PATH
from page.app_page_enter_home import AppPageEnterHome
from page.page_login import PageLogin
from tools import read_json


class TestLogin(object):
    arg_name = 'phone,pwd,expect,img'
    @pytest.mark.smoke('冒烟测试')
    @pytest.mark.parametrize(arg_name, read_json('login_data.json'))
    def test_login_success(self, driver,phone,pwd,expect,img):
        self.app_login = PageLogin(driver)
        self.app_login.login_input(phone,pwd)
        result = self.app_login.get_toast_result()
        print(f'登录结果：{result}')
        assert expect in result
        self.app_login.get_shot(img)

    # def test_login_fail(self, driver):
    #     self.page.login_input("13100003030","asd12345")
    #     self.result01 = self.page.get_toast_result()
    #     assert '账号不存在!' in self.result01
    #     self.page.get_shot('login_fail.png')
    #
    # def test_login_pwd_fail(self):
    #     self.page.login_input("13100001010","asd123456")
    #     self.result02 = self.page.get_toast_result()
    #     assert '密码错误!' in self.result02
    #     self.page.get_shot('password_fail.png')
    #

